package com.darthsith.droidathome.core.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;


/**
 * This class is a model for the Arduino UNO Board
 * 
 * @author andrea
 *
 */
@Entity
@Table(name="ARDUINO_BOARD")
public class ArduinoBoard {
	
	@Id
	@Column(name="IPADDRESS")
	private String ipAddress;
	@Column(name="MACADDRESS")
	private String macAddress;
	@Column(name="NAME")
	private String name;
	@Column(name="SENSORS")
	@OneToOne @JoinColumn(table="SENSOR", referencedColumnName="IPADDRESS")
	private List<Sensor> sensors;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getMacAddress() {
		return macAddress;
	}
	public void setMacAddress(String macAddress) {
		this.macAddress = macAddress;
	}
	public String getIpAddress() {
		return ipAddress;
	}
	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}
	public List<Sensor> getSensors() {
		return sensors;
	}
	public void setSensors(List<Sensor> sensors) {
		this.sensors = sensors;
	}

	@Override
	public String toString() {
		return "AS:\nname: "+name+"\nmacAddress: "+macAddress+"\nSS: [\n"+sensors;
	}
	
}
